<?php
/**
 * 支付宝 支付
 * @author xjq
 * 2018年11月19日
 */
class AliPay extends MY_Controller
{
	function __construct()
    {
        parent::__construct();
        //加载 支付宝支付 接口模型
        $this->load->model('AliPay_model','ap');
    }


    function index(){
        $backUrl=base_url().'WxPay/backChangeAliPay';// 支付回调
        $finalUrl=base_url().'WxPay/finishAliPay';// 支付完成后的跳转地址
        $c = new AopClient;
        $c->gatewayUrl = "https://openapi.alipay.com/gateway.do";
        $c->appId = "app_id";
        $c->rsaPrivateKey = '请填写开发者私钥去头去尾去回车，一行字符串' ;
        $c->format = "json";
        $c->charset= "GBK";
        $c->signType= "RSA2";
        $c->alipayrsaPublicKey = '请填写支付宝公钥，一行字符串';
        //实例化具体API对应的request类,类名称和接口名称对应,当前调用接口名称：alipay.open.public.template.message.industry.modify
        $request = new AlipayOpenPublicTemplateMessageIndustryModifyRequest();
        //SDK已经封装掉了公共参数，这里只需要传入业务参数
        //此次只是参数展示，未进行字符串转义，实际情况下请转义
        $request->bizContent = "{" .
        "    \"primary_industry_name\":\"IT科技/IT软件与服务\"," .
        "    \"primary_industry_code\":\"10001/20102\"," .
        "    \"secondary_industry_code\":\"10001/20102\"," .
        "    \"secondary_industry_name\":\"IT科技/IT软件与服务\"" .
        " }";
        $response= $c->execute($request);
    }

    function finishAliPay(){
        echo '支付成功！';
    }

    function backChangeAliPay(){
        echo "SUCCESS";
    }

}